<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * php artisan make:migration create_article_table
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('icon');
            $table->string('title');
            $table->text('content');
            $table->smallInteger('user_id')->nullable(false)->comment('upload admin user id');
            $table->string('source', 30)->nullable(true)->comment('the original images name');
            $table->string('folder', 100)->nullable(true)->default('tmp');
            $table->char('is_active', 1)->default(0);
            $table->char('is_recommend', 1)->default(0);
            $table->char('is_approved', 1)->default(0);
            $table->char('is_original', 1)->default(0);
            $table->string('approved_user', 10)->default(null);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article');
    }
}
